<?php
include '../config.php';
function GetLevelByName($name, $conn) {
    $sql = "SELECT * FROM userdata where bind_user = '$name'";
    $result = $conn->query($sql);
    $count = $result->fetch_assoc()['level'];
    $sun = str_repeat("☀️", floor($count / 27));
    $moon = str_repeat("🌙", floor($count / 9) % 3);
    $star = str_repeat("⭐", floor($count / 3) % 3);
    return $sun . $moon . $star;
}
$sql = 'SELECT * FROM userdata where bind_user = "' . $_GET['nickname'] . '"';
$result = $conn->query($sql);
if ($result->num_rows > 0){
    $row = $result->fetch_assoc();
    echo '用户名:' . $row['bind_user'] . "<br />";
    echo '用户id:' . $row['id'] . "<br />";
    echo 'ebchat等级:' . GetLevelByName($row['bind_user'], $conn);
} else {
    echo '该用户为老版本用户';
}
?>
